// 财务报表
import axios from 'axios'
const modelUrl = '/finance'
// 收支明细情况统计
export interface IncomeExpendDetailStatRes {
  reportDate: string
  remark: string
  accountName: string
  feeCategory: string
  feeUsage: string
  incomeAmt: number
  expendAmt: number
}
export interface IncomeExpendDetailStatSearch {
  dates: string[]
  startDate: string
  endDate: string
  accountName: string
  usedObj: string
  feeCategory: string
  statType?: number
}
export function getIncomeExpendDetailStat(data?: IncomeExpendDetailStatSearch) {
  return axios.post<{ list: IncomeExpendDetailStatRes[] }>(
    modelUrl + '/incomeExpendDetailStat',
    data
  )
}
// 生产明细统计
export interface ProdDetailStatRes {
  reportDate: string
  processName: string
  productName: string
  mainDirectorName: string
  unit: string
  qty: number
  remark: string
}
export interface ProdDetailStatSearch {
  dates: string[]
  startDate: string
  endDate: string
  unit: string
  processName: string
  productName: string
  mainDirectorName: string
}
export function getProdDetailStat(data?: ProdDetailStatSearch) {
  return axios.post<{ list: ProdDetailStatRes[] }>(modelUrl + '/prodDetailStat', data)
}
// 月收支情况统计
export interface MonthIncomeExpendStatRes {
  remark: string
  expendAmt: string
  incomeAmt: string
  reportMonth: string
}
export interface MonthIncomeExpendStatSearch {
  dates: string[]
  startDate: string
  endDate: string
}
export function getMonthIncomeExpendStat(data?: MonthIncomeExpendStatSearch) {
  return axios.post<{ list: MonthIncomeExpendStatRes[] }>(modelUrl + '/monthIncomeExpendStat', data)
}
// 总资产统计
export interface FinanceTotalAssetStatRes {
  remark: string
  itemName: string
  amt: number
  itemList: {
    itemName: string
    accountName: string
    amt: number
    remark: string
  }[]
  children: {
    itemName: string
    accountName: string
    amt: number
    remark: string
  }[]
}
export interface FinanceTotalAssetStatSearch {
  dates: string[]
  startDate: string
  endDate: string
}
export function getFinanceTotalAssetStat(data?: FinanceTotalAssetStatSearch) {
  return axios.post<{ list: FinanceTotalAssetStatRes[] }>(modelUrl + '/financeTotalAssetStat', data)
}
// 采购类型情况统计
export interface FinancePurchaseTypeStatRes {
  purchaseType: string
  totalAmt: number
  itemDetailList: number[]
  itemList: {
    supplierId: number
    supplierName: string
    totalAmt: number
    itemDetailList: number[]
  }[]
  children: {
    supplierId: number
    supplierName: string
    totalAmt: number
    itemDetailList: number[]
  }[]
}
export interface FinancePurchaseTypeStatSearch {
  dates: string[]
  startDate: string
  endDate: string
}
export function getFinancePurchaseTypeStat(data?: FinancePurchaseTypeStatSearch) {
  return axios.post<{ list: FinancePurchaseTypeStatRes[] }>(
    modelUrl + '/financePurchaseTypeStat',
    data
  )
}
